package web.hibernate;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Basic;
import javax.persistence.Column;
import java.util.Arrays;

/**
 * Created by IntelliJ IDEA.
 * User: user
 * Date: Jan 31, 2010
 * Time: 9:15:03 PM
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(catalog = "strutshibernatespring", name = "obj_type")
public class ObjTypeEntity {
  private long objId;

  @Basic
  @Column(name = "obj_id", length = 10)
  public long getObjId() {
    return objId;
  }

  public void setObjId(long objId) {
    this.objId = objId;
  }

  private char[] objName;

  @Basic
  @Column(name = "obj_name", length = 78)
  public char[] getObjName() {
    return objName;
  }

  public void setObjName(char[] objName) {
    this.objName = objName;
  }

  private char[] objRsn;

  @Basic
  @Column(name = "obj_rsn", length = 4)
  public char[] getObjRsn() {
    return objRsn;
  }

  public void setObjRsn(char[] objRsn) {
    this.objRsn = objRsn;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    ObjTypeEntity that = (ObjTypeEntity) o;

    if (objId != that.objId) return false;
    if (!Arrays.equals(objName, that.objName)) return false;
    if (!Arrays.equals(objRsn, that.objRsn)) return false;

    return true;
  }

  @Override
  public int hashCode() {
    int result = (int) (objId ^ (objId >>> 32));
    result = 31 * result + (objName != null ? Arrays.hashCode(objName) : 0);
    result = 31 * result + (objRsn != null ? Arrays.hashCode(objRsn) : 0);
    return result;
  }
}
